use strict;
use warnings;

use Test::More tests => 5;

use HTML::FormFu;

my $form = HTML::FormFu->new->load_config_file('t/element_repeatable.yml');

# submitting a count should automatically call:
# $form->count(1);
# $form->repeat;

$form->process({
    count => 1,
    foo   => [qw/ foo bar /],
});

my $foo = $form->get_fields('foo');
is( scalar @$foo, 2 );

is_deeply( $form->params->{foo}, [qw/ foo bar /] );

my $render_fields = $form->render->fields('foo');

is( scalar @$render_fields, 2 );

is( $render_fields->[0]->{value}, 'foo' );
is( $render_fields->[1]->{value}, 'bar' );
